Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DNS server IP address parameter to Invoke-Maester #684

Closed
wants to merge 1 commit into from

Conversation

moorereason
Copy link
Contributor

To allow the user to pass a custom DNS server IP address down to the underlying CISA Exchange tests, add a cmdlet parameter named DnsServerIpAddress to Invoke-Maester. The default value remains 1.1.1.1.

To enable passing custom data down to the tests, I began using the $PesterConfiguration.Run.Container property. The container will now hold the Path to the tests as well as the custom Data object. The DnsServerIpAddress parameter will be passed to all tests, but the parameter will be silently ignored by any tests without that parameter defined.

Updates: #612

To allow the user to pass a custom DNS server IP address down to the
underlying CISA Exchange tests, add a cmdlet parameter named
DnsServerIpAddress to Invoke-Maester.  The default value remains
`1.1.1.1`.

To enable passing custom data down to the tests, I began using the
$PesterConfiguration.Run.Container property.  The container will now
hold the Path to the tests as well as the custom Data object. The
DnsServerIpAddress parameter will be passed to all tests, but the
parameter will be silently ignored by any tests without that parameter
defined.
@moorereason moorereason requested a review from a team as a code owner February 21, 2025 16:04
@soulemike
Copy link
Contributor

Thanks for the PR! I am curious if there are pros/cons to passing this value through Pester versus the module itself.

@moorereason
Copy link
Contributor Author

I'm not a Maester or Pester expert (I'm new to both), so don't take my word for it. After digging into how Invoke-Maester works, the command flow appears to be: Invoke-MaesterInvoke-Pester$CHECK.Tests.ps1$CHECK.ps1

The only way I could see to send parameters to a $CHECK.ps1 module was to pass them through Invoke-Pester. If there are more preferable ways to accomplish this, I'm open to it.

@moorereason
Copy link
Contributor Author

The major issue to this approach is that all tests would now share a parameter namespace from Invoke-Maester. Whatever Data parameters we pass to Invoke-Pester will be passed to every test. I could foresee more requests coming in to add additional parameters to be passed down to the tests. We'd need to be careful how that's implemented.

@merill
Copy link
Contributor

merill commented Feb 24, 2025

@moorereason thanks for the PR.

This goes to the bigger feature around how to pass configuration parameters for various commands and tests (e.g. defining emergency access accounts, accepted number of global admins, etc)

We are tracking this in this feature and is something we've been wanting to implement for some time.
#40

This way we can use an extensible model to pass config parameters without having to update Invoke-Maester for each test.

Just haven't got around to implementing yet.

@merill merill self-assigned this Feb 24, 2025
@moorereason
Copy link
Contributor Author

Closing since this isn't the right direction for the project. I'll look into the PSFramework configurations, if I can find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants